fix(ci): use repository_dispatch for polish release notes#545
Conversation
The GitHub App token doesn't have actions:write permission, which is required for workflow_dispatch. Switch to repository_dispatch which works with existing contents:write permission. Changes: - release-prepare.yml: Use gh api to trigger repository_dispatch - polish-release-notes.yml: Add repository_dispatch trigger type - Delete test workflow (validation complete) Tested via PR #542 - both workflow_dispatch and repository_dispatch triggers work correctly with claude-code-action.
📝 WalkthroughWalkthroughThe changes modify GitHub Actions workflows to use Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Review CompleteYour review story is ready! Comment !reviewfast on this PR to re-generate the story. |
Greptile SummaryFixes CI failure by switching from
The solution is straightforward and follows the validation done in the test workflow. Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant M as Main Branch Push
participant R as Release Prepare Workflow
participant C as Changesets Action
participant N as npm Registry
participant A as GitHub API
participant P as Polish Release Notes Workflow
participant G as GitHub Releases
M->>R: Trigger on push to main
R->>C: Run changesets action
alt Version PR not merged yet
C->>R: Create/update Version PR
R-->>M: Wait for Version PR merge
else Version PR merged
C->>N: Publish package to npm
C->>G: Create GitHub release with changelog
C->>R: Set published=true output
R->>A: POST /repos/{owner}/{repo}/dispatches
Note over R,A: event_type: polish-release-notes<br/>client_payload: {tag_name: "vX.Y.Z"}
A->>P: Trigger repository_dispatch event
P->>G: Fetch raw release notes
P->>P: Transform with Claude Code Action
P->>G: Update release with polished notes
end
|
| gh api repos/${{ github.repository }}/dispatches \ | ||
| --method POST \ | ||
| --input - <<< "{\"event_type\":\"polish-release-notes\",\"client_payload\":{\"tag_name\":\"$TAG\"}}" |
There was a problem hiding this comment.
style: The $TAG variable is directly interpolated into JSON without proper escaping. If the tag contains special characters (quotes, backslashes), this could produce invalid JSON.
| gh api repos/${{ github.repository }}/dispatches \ | |
| --method POST \ | |
| --input - <<< "{\"event_type\":\"polish-release-notes\",\"client_payload\":{\"tag_name\":\"$TAG\"}}" | |
| gh api repos/${{ github.repository }}/dispatches \ | |
| --method POST \ | |
| --field event_type=polish-release-notes \ | |
| --field "client_payload[tag_name]=$TAG" |
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/release-prepare.yml
Line: 74:76
Comment:
**style:** The `$TAG` variable is directly interpolated into JSON without proper escaping. If the tag contains special characters (quotes, backslashes), this could produce invalid JSON.
```suggestion
gh api repos/${{ github.repository }}/dispatches \
--method POST \
--field event_type=polish-release-notes \
--field "client_payload[tag_name]=$TAG"
```
How can I resolve this? If you propose a fix, please make it concise.
Summary
Fixes the CI failure where the release pipeline couldn't trigger the polish workflow.
Root Cause
The GitHub App token doesn't have
actions:writepermission, which is required forworkflow_dispatch. The error was:Solution
Switch to
repository_dispatchwhich:contents:writepermissionChanges
gh apito triggerrepository_dispatchinstead ofgh workflow runrepository_dispatchtrigger type alongside existingworkflow_dispatchTest Plan
repository_dispatchworks via PR test: validate repository_dispatch for polish workflow #542🤖 Generated with Claude Code
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.